<?php
include ('../inicio/conectarse.php');
session_start();

$id = $_GET['q'];

$qry = "DELETE FROM repartidores WHERE ID_REPARTIDOR = ".$id;
$result = mysql_query($qry);

if($result) {
	$print = '<h2> Se ha eliminado el registro! </h2>';
}else {
	$print = '<h2> Error al eliminar el registro! </h2>';
}

$qry = "SELECT ID_REPARTIDOR, NOMBRE, TELEFONO
		FROM repartidores";
$result = mysql_query($qry);

$group = array();
$ind = 0;		 
while ($member = mysql_fetch_array($result, MYSQL_ASSOC)) {	
	$group[$ind]=$member;
	$ind = $ind + 1;
}
	$print = $print .'<table id="hor-minimalist-a">';
	$print = $print .'<thead><tr>';
	$print = $print .'<th scope="col">NOMBRE</th>';
	$print = $print .'<th scope="col">TELEFONO</th>';
	$print = $print .'<th scope="col">UPDATE</th>';
	$print = $print .'<th scope="col">DELETE</th>';
	$print = $print .'</tr></thead>';
foreach ($group as $ind => $valor) 
{	
	$print = $print .'<tr>';
	$print = $print .'<td>'.$valor["NOMBRE"].'</td>';
	$print = $print .'<td>'.$valor["TELEFONO"].'</td>';
'../../paginas/Repartidor/repartidor-form.php?q='.$valor["ID_REPARTIDOR"].'\'); return false"> </td>';
	$print = $print .'<td><input type="radio" name="group1" value="Borrar" onclick="MostrarConsulta(\'../../paginas/Repartidores/ajax-exec.php?q='.$valor["ID_REPARTIDOR"].'\',\'resultado\'); return false"> </td>';
	$print = $print .'</tr>';
}	
$print = $print .'</table>';
echo $print;
?>